package a27_GenericityUse.ComprehensivePra;

/**
 * @Author quan
 * @Description 父类
 * @Date 2023/2/19 21:38
 */
public abstract class Animal {
    private String name;
    private int age;

    public Animal() {
    }

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
    //eat方法:抽象方法(因为每个动物吃的东西都不一样)
    public abstract void eat();
    //toString方法
    public String toString(){
        return "Animal{name = "+name+",age = "+age+"}";
    }
}
